import { defineComponent } from 'vue'
import useRemoteData, { remoteWidgetPropDefine } from '../hooks/useRemoteData'
import { CheckboxGroup, Spin } from 'ant-design-vue'

export default defineComponent({
  name: 'SpsCheckbox',
  props: {
    ...remoteWidgetPropDefine
  },
  setup(props, { attrs }) {
    const { options, optionsLoading } = useRemoteData(props)
    /* render 函数 */
    return () => {
      return (
        <Spin spinning={optionsLoading.value}>
          <CheckboxGroup options={options.value} {...attrs} />
        </Spin>
      )
    }
  }
})
